<template>
  <n-upload v-bind="$attrs" :headers="headers" v-model:file-list="fileList">
    <slot />
  </n-upload>
</template>
<script lang="ts" setup>
import { computed, ref } from "vue";
import { IBasicUploadProps } from "./props";
import { uploadUrl } from "@/api/basic/basic.api";
import { getHeaders } from "@/common/utils/comps/index";
import { UploadFileInfo } from "naive-ui";
const props = defineProps<IBasicUploadProps>();

const headers = getHeaders();
const fileList = ref<UploadFileInfo[]>([]);

const uploadAction = computed(() => {
  let url = uploadUrl;
  if (props.biz) {
    url += `?biz=${props.biz}`;
  }
  return url;
});
</script>
